package com.soft.config;

import com.soft.interceptor.LoginHandlerInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class AdminConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
//        registry.addViewController( "/gyx" ).setViewName( "test" );
        //主页面
        registry.addViewController("/admin").setViewName("/admin/index");
        registry.addViewController("/admin/index.html").setViewName("/admin/shop");
        registry.addViewController("/admin/user.html").setViewName("/admin/user");
        registry.addViewController("/admin/all-product.html").setViewName("admin/all-product");
        registry.addViewController("/admin/orders.html").setViewName("admin/orders");
        registry.addViewController("/admin/test").setViewName("admin/newform");

        registry.addViewController("/admin/login").setViewName("admin/login");
        registry.addViewController("/ac").setViewName("admin/notuse/accordation");
        registry.addViewController("/counter").setViewName("admin/notuse/counter");
//        registry.addViewController("").setViewName("/user/index");
//        registry.addViewController("/index").setViewName("/user/index");
//        //用户登录页面
//        registry.addViewController("/login").setViewName("/user/login");
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new LoginHandlerInterceptor()).
////                .addPathPatterns("/**").
//        excludePathPatterns("index2","index", "/user/login", "/js/**","/css/*",
//        "/img/**", "/fonts/**","/image/**","/picture/**",
//        "*.js", "/images/**","/lay/**", "/layui/**","/img/**");
    }
}
